<template>
    <view class="shopIntro">
        <view class="title">品牌介绍</view>
        <view class="edit-box">
            <view class="edit-border">
                 <MyEditor   @getEditor="getEditor"  />
            </view>
        </view>
        <view class="text">品牌图片与品牌介绍必须至少有一项有内容</view>
        <button class="submit" @tap="handleSubmit" :disabled="Boolean(!this.businessBrand.length)">保存</button>
    </view>
</template>
<script lang="ts">
import {Vue, Component} from 'vue-property-decorator';
import MyEditor from '@components/myEditor/index.vue';
import {postUpbrand} from '@/request/actions'


@Component({
    components:{
        MyEditor
    }
   
})
export default class extends Vue{
     salonId:string|number = '';
     businessBrand:string = '';
    getEditor(res:any){
        let {html,text} = res;
    
        if(text.length != 0 ){
                this.businessBrand = html;
        }else{
            this.businessBrand = '';
        }
        
        
    }   
     handleSubmit(){
            let salonId = this.salonId;
            let businessBrand = this.businessBrand;

            postUpbrand({salonId,businessBrand}).then((r:any)=>{
                     let {data:res} = r;

                     if(res.status == 200){
                                uni.showModal({
                                    content:'设置成功',
                                    showCancel:false,
                                    success:(res:any)=>{
                                        uni.navigateBack();
                                    }
                                })
                            }
            })
     }
     onLoad(query:any){
         this.salonId = query.salonId;
     }
}
</script>
<style lang="scss">
@import './_static/scss/index.scss';
</style>

